Conversation
tawebbcn
left a comment
There was a problem hiding this comment.
If you have time, try to do the first iterations again to get them right. If you need any help let us now and one of us will help you right away! :)
|
|
||
| // Lorem ipsum generator | ||
| //Let's get looping | ||
| for (var i = 0; i < hacker1.length || hacker2.length; i++){ |
There was a problem hiding this comment.
The challenge here was to compare the length of two element. It would have been easier to just compare element1.length and element2.length with no need to use a for loop since you can get the length of a string directly with the ".length()" property. Then you only return the one that is longer (if element1.length < element2.length return element2)
| } | ||
|
|
||
| //loops driver name backwards | ||
| for(let i = hacker.length; i > 0; i--){ |
There was a problem hiding this comment.
here for 'samuel' backwards you'd get 'amuel', missing the first letter. To reach the first letter you need to iterate backwards and set the condition of the for loop (the middle statement) to also equal 0, just like this:
for(let i = hacker.length; i >= 0; i--) You only forgot to add the equal symbol
No description provided.